
<%
DIRECTIVE SAFE_OUTPUT_OPEN;
var headContent = {
include("/pages/template/head.html"){}
%>
<script type="text/javascript">
	var form = $("#routingForm");
	var moderrouting = {
		routingsave : function() {
		debugger;
			if (!validForm()) {
				return false;
			}

			var vasPidStr = "";
			var flag = true;
			$('input[name="checkedids"]:checked').each(function() {
				vasPidStr += $(this).val() + ',';
			});
			
			if (vasPidStr == "") {
				BootstrapDialog.alert("请先选择平台产品");
				return;
			}else{
				vasPidStr = vasPidStr.substring(0, vasPidStr.length - 1);
			}

			var url = 'system/moderrouting/save/' + vasPidStr;
			form1.action = url;
			form1.submit();
			return true;
			},
		querAreaByProvince:function(value){
			$("#city").empty();
			$("#city").prepend("<option value='0000'>全部地区</option>");
			
			var len = $("#area option").length;
			console.log(len + '##########')
			for (var i=0; i<=len; i++) {
				if ($($("#area option")[i]).attr('name') == value) {
					console.log($("#area option")[i])
					$("#city").append($("#area option")[i]);
				}	
			}
		},
		queryProductlist : function() {
			var form = $("#routingForm");
			var queryProductName = $("#queryProductName").val();
			var url = 'system/moderrouting/add?queryProductName='
					+ queryProductName;
			form.action = url;
			form.submit();
		}
	};
</script>

<%
};
var bodyContent = {
%>

<form id="routingForm" name="form1" action="" method="post" class="form-horizontal" role="form">
	<table class="table">
		<% // 列表头部 %>
		<tr>
			<td>客户名称</td>
			<td>
				<select name="model.customerId" class="form-control" valid="vselect" validname="客户名称">
				<option value="-1">请选择</option>
					${selectCustomer }
				</select>
			</td>
			<td>选择供应商</td>
			<td>
				<select name="model.provider" class="form-control" valid="vselect" validname="供应商名称">
				<option value="-1">请选择</option>
					${selectProvider }
				</select>
			</td>
			
		</tr>
		<tr>
			<td>产品省份</td>
				<td>
				<select  name="model.province" class="form-control" valid="vselect" validname="产品省份" onchange="moderrouting.querAreaByProvince(this.value)" >
					${selectProvince }
				</select>
			</td>
			<td>号码归属地</td>
				<td>
				<select id="city" name="model.numberAttribution" class="form-control" >
					<option value="0000">全部地区</option>
				</select>
			</td>
	
			
		</tr>
		<tr style="display: none">
			<td >111</td>
			<td>
				<select id="area" name="" class="form-control" valid="vselect" validname="号码归属地"  valid="vselect">
					${selectArea }
				</select>
			</td>
		</tr>
		<tr>
			<td>产品运营商</td>
			<td>
				<select name="model.operator" class="form-control" valid="vselect" >
					<option value="-1">--请选择--</option>
					<option value="1" ${model.operator=="1"?"selected":"" }>中国电信</option>
					<option value="2" ${model.operator=="2"?"selected":"" }>中国移动</option>
					<option value="3" ${model.operator=="3"?"selected":"" }>中国联通</option>
				</select>
			</td>
			
				<td>状态</td>
				<td>
				<select name="model.status" class="form-control" valid="vselect" >
					<option value="-1">--请选择--</option>
					<option value="0" ${model.status=="0"?"selected":"" }>有效</option>
					<option value="1" ${model.status=="1"?"selected":"" }>失效</option>
				</select>
			</td>
		</tr>
		<tr style="display: none">
			<td>是否执行</td>
			<td>
				<input class="form-control" type="text" name="model.isExecutor" value="0" />
			</td>
		</tr>
		
		<tr style="display: none">
			<td>用于获取值</td>
			<td>
				<input class="form-control" id="myselectids" type="text" />
			</td>
		</tr>
	</table>




	<div class="tableSearch">
		<%  //查询列表 %>
		<div class="form-group" style="width: 50%; display: inline-block">
			<input class="form-control" type="text" id="queryProductName" name="productName" value="${productName!''}" placeholder="请输入产品名称" />
		</div>
		&nbsp;&nbsp;&nbsp;
		<button type="button" class="btn btn-default" onclick="resetForm();">
			<span class="glyphicon glyphicon-refresh"></span>
			重 置
		</button>
		<button type="button" class="btn btn-default" onclick="moderrouting.queryProductlist();" name="search">
			<span class="glyphicon glyphicon-search"></span>
			查 询
		</button>

	</div>


	<div style="height: 300px; overflow: scroll; overflow-x: hidden">
		<!-- 数据列表 -->
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<%  // 列表头部 %>
					<th name="ids" style="width: 5%"></th>
					<th name="vasProdName" style="width: 45%">平台产品名称</th>
					<th name="operatorType">运营商</th>
					<th name="productPrice">价格</th>
				</tr>
			</thead>
			<tbody>
				<% for(item in page){ %>
				<tr>
					<td>${itemLP.index }</td>
					<td>
						<input type="checkbox" id="routing_${item.ids}" name="checkedids" value="${item.ids}" />
					</td>
					<%  // 列表内容 %>
					<td>${item.vasProdName}</td>
					<td>
						<% if(item.operatorType=="1") { %>
						中国电信
						<%	} %>
						<% if(item.operatorType=="2") { %>
						中国移动
						<%	} %>
						<% if(item.operatorType=="3") { %>
						中国联通
						<%	} %>
					</td>
					<td>${item.productPrice}</td>
				</tr>
				<% } %>
			</tbody>
		</table>
	</div>


	<div style="height: 50px; clear: both;">&nbsp;</div>
	<nav class="navbar navbar-default navbar-fixed-bottom">
		<div class="container" style="padding: 5px 0px 5px 0px; text-align: center;">

			<button class="btn btn-default" onclick="closeIframe();return false;">关 闭</button>
			<button class="btn btn-primary" onclick="moderrouting.routingsave();return false;">保 存</button>

		</div>
	</nav>
</form>
<%}; %>

<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
DIRECTIVE SAFE_OUTPUT_CLOSE;
<%} %>